package com.dgshanger.sanhxiaofeisc.mvp.model

import com.dgshanger.sanhxiaofeisc.common.AppApi
import com.dgshanger.sanhxiaofeisc.entity.NearbyItemEntity
import com.dgshanger.sanhxiaofeisc.mvp.contract.CategoryContract
import com.xx.baseutilslibrary.network.rx.RxHelper
import com.xx.baseutilslibrary.network.rx.XxBaseHttpObserver

/**
 * Created by JacobHHH on 2018/5/4.
 */
class CategoryModel : CategoryContract.Model {

    override fun loadData(location_name: String?, sort_distance: String?, user_longitude: String?,
                          user_latitude: String?, page: String?, sort_new: String?, sort_comment: String?,
                          shop_name: String?, shop_cate_id: String?, httpObserver: XxBaseHttpObserver<MutableList<NearbyItemEntity>>?) {

        AppApi.Api().getCategoryShopData(location_name,sort_distance,user_longitude,user_latitude,
                page,sort_new,sort_comment,shop_name,shop_cate_id)
                .compose(RxHelper.io_main())
                .compose(RxHelper.start_finish(httpObserver))
                .subscribe(httpObserver)
    }
}